import { Column, Entity, OneToMany, PrimaryColumn } from 'typeorm'
import { EventAnalytics } from '@boticord/analytics/models/event-analytics.model'

@Entity()
export class SessionAnalytics {
  @PrimaryColumn()
  declare ip: string

  @OneToMany(() => EventAnalytics, e => e.session)
  declare events: EventAnalytics[]

  @Column({ nullable: true })
  declare city?: string

  @Column({ nullable: true })
  declare country?: string

  @Column({ nullable: true })
  declare region?: string

  @Column({ nullable: true })
  declare timezone?: string

  @Column({ nullable: true })
  declare isp?: string

  @Column({ nullable: true })
  declare asn?: number
}